package com.zy.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 组件上报类型
 * 0 自动上报 1 手动上报
 *
 * @author hanhuafeng
 * @version V1.0
 * @description
 * @date 2023/7/18
 */
public enum ReportTypeEnum {
    /**
     * 自动上报
     */
    AUTO(0, "自动上报"),
    /**
     * 手动上报
     */
    MANUAL(1, "手动上报");

    @JsonValue
    private final Integer code;
    private final String desc;

    ReportTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @JsonCreator
    public static ReportTypeEnum getByCode(Integer code) {
        for (ReportTypeEnum value : ReportTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
